//
//  RepairsApplyModel.m
//  AILock
//
//  Created by 谭亚明 on 2020/7/23.
//  Copyright © 2020 tym. All rights reserved.
//

#import "RepairsApplyModel.h"

@implementation RepairsApplyModel

-(NSString*)getStatusStr{
    
    if (self.status == 1) {
         return @"申请中";
    }else if(self.status == 2){
         return @"已接受";
    }else if(self.status == 3){
         return @"处理中";
    }else if(self.status == 4){
       return @"已完成";
    }
    else if(self.status == 9){
        return @"已取消";
    }
    return @"";
}

-(NSString*)openDirectionStr{
    switch (self.openDirection) {
        case 1:
            return @"左内开";
            break;
        case 2:
            return @"左外开";
            break;
            case 3:
            return @"右内开";
            break;
            case 4:
            return @"右外开";
            break;
        default:
            break;
    }
    return @"";
}

-(NSString*)guideVaneSpecificationStr{
    switch (self.guideVaneSpecification) {
        case 1:
            return @"直角双孔";
            break;
        case 2:
            return @"直角单孔";
            break;
        case 3:
            return @"圆角双孔";
            break;
        case 4:
            return @"圆角单孔";
            break;
        default:
            break;
    }
    return @"";
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key

{

    

}



-(id)valueForUndefinedKey:(NSString *)key

{

  

    return nil;

}

//有些属性 为空了我后续用到经常会崩溃 下面这个方法把<null>转为空字符串

-(void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues

{

    NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithDictionary:keyedValues];

    NSArray *valueArray= [dic allKeys];

    for (NSString *key in valueArray) {

        if ([[dic objectForKey:key]isEqual:[NSNull null]]) {

                [dic setObject:@"" forKey:key];

        }

    }

    [super setValuesForKeysWithDictionary:dic];

}
@end
